home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 9 / The PC-SIG Library on CD ROM - Ninth Edition.iso / 301_400 / DISK0324 / DISK0324.ZIP / PDEMOENT.PAS < prev    next >
Pascal/Delphi Source File  |  1985-02-21  |  6KB  |  129 lines

  1. Program PDEMOENT;  {Copyright  R D Ostrander
  2.                                Ostrander Data Services
  3.                                5437 Honey Manor Dr
  4.                                Indianapolis  IN  46241
  5.  
  6.      This is a demonstration program for the Turbo Pascal subroutine PTOOLENT
  7.      for intelligent field editting. Address any questions to the author at
  8.      the above address.                                                      }
  9.  
  10. { $ C - } { This parameter is optional - the PTOOLENT subroutine will identify
  11.             and report Ctrl-Break during field editting.                      }
  12.  
  13. {$V-}     { This parameter is necessary in order to pass String parameters
  14.             of other than 80 characters.                                   }
  15.  
  16. Var
  17.  
  18.     Data      : String [80];
  19.     DataI     : Integer     absolute Data;
  20.     DataR     : Real        absolute Data;
  21.     Size      : Integer;
  22.     Decimals  : Integer;
  23.     RetCode   : Integer;
  24.     DataType  : Char;
  25.  
  26.  
  27. {$I PTOOLENT.INC}  {Include statement for PTOOLENT procedure}
  28.  
  29.  
  30. BEGIN
  31.  
  32.      ClrScr;
  33.      Gotoxy (15,5); Write ('Demonstration of PTOOLENT procedure.');
  34.      Gotoxy (15,7); Write ('PTOOLENT and this program are copyrights');
  35.      Gotoxy (15,8); Write ('of R D Ostrander');
  36.      Gotoxy (15,9); Write ('   Ostrander Data Services');
  37.      Gotoxy (15,10); Write ('   5437 Honey Manor Dr');
  38.      Gotoxy (15,11); Write ('   Indianapolis  IN  46241');
  39.      Delay (5000);
  40.      ClrScr;
  41.      RetCode := 0;
  42.      DataType := ' ';
  43.      While (DataType <> 'X')
  44.        and (RetCode <> 79)   do
  45.            Begin
  46.                 Gotoxy (5, 2);
  47.                 Write ('What type of data would you like to test?  ');
  48.                 Gotoxy (5, 3);
  49.                 Write ('S = String');
  50.                 Gotoxy (5, 4);
  51.                 Write ('I = Integer');
  52.                 Gotoxy (5, 5);
  53.                 Write ('R = Real');
  54.                 Gotoxy (5, 6);
  55.                 Write ('X = Exit');
  56.                 While (DataType <> 'S')
  57.                   and (DataType <> 'I')
  58.                   and (DataType <> 'R')
  59.                   and (DataType <> 'X') do
  60.                       Begin
  61.                            Gotoxy (47, 2);
  62.                            Read (KBD, DataType);
  63.                            Write (DataType);
  64.                            DataType := UpCase (DataType);
  65.                       End;
  66.                 If DataType <> 'X' then
  67.                    Begin
  68.                         Size := 0;
  69.                         Gotoxy (5, 8);
  70.                         Write ('What size display area?      (1 thru 80)');
  71.                         Gotoxy (34, 9);
  72.                         Write ('(Press  End  to Exit)');
  73.                         Gotoxy (30, 8);
  74.                         While ((Size < 1)
  75.                                 or (Size > 80))
  76.                           and (RetCode <> 79) do
  77.                               PTOOLENT (Size, 'I', 2, 0, RetCode);
  78.                         Gotoxy (5, 11);
  79.                         Decimals := 0;
  80.                         If (DataType = 'R')
  81.                        and (RetCode <> 79) then
  82.                            Begin
  83.                                 Write ('How many decimal places? ');
  84.                                 PTOOLENT (Decimals, 'I', 2, 0, RetCode);
  85.                            End
  86.                            else ClrEol;
  87.                         If RetCode <> 79 then
  88.                            Begin
  89.                                 Gotoxy (1, 14);
  90.                                 Write ('Editting area below:');
  91.                                 Case DataType of
  92.                                      'S' : Data  := 'ABCDEF';
  93.                                      'I' : DataI := 12345;
  94.                                      'R' : DataR := 1.23456789;
  95.                                      End; {Case}
  96.                                 Gotoxy (1, 16);
  97.                                 ClrEol;
  98.                                 LowVideo;
  99.                                 PTOOLENT (Data, DataType, Size, Decimals,
  100.                                           RetCode);
  101.                                 NormVideo;
  102.                                 Gotoxy (1, 19);
  103.                                 Write ('Output is: ');
  104.                                 ClrEol;
  105.                                 Case DataType of
  106.                                      'S' : Write ('(', Data, ')');
  107.                                      'I' : Write ('(', DataI:Size, ')');
  108.                                      'R' : Write ('(', DataR:Size:Decimals,
  109.                                                   ')');
  110.                                      End; {Case}
  111.                                 Gotoxy (1, 20);
  112.                                 ClrEol;
  113.                                 Write ('Data Type is: ', DataType);
  114.                                 Gotoxy (1, 21);
  115.                                 ClrEol;
  116.                                 Write ('Size is: ', Size);
  117.                                 If DataType = 'R' then
  118.                                    Write ('.', Decimals);
  119.                                 Gotoxy (1, 22);
  120.                                 ClrEol;
  121.                                 Write ('Return Code is: ', RetCode);
  122.                                 DataType := ' ';
  123.                                 RetCode := 0;
  124.                            End;
  125.                    End;
  126.  
  127.            End;
  128.      Gotoxy (1,24);
  129. END.